package com.longtu.chat.vo;

import java.util.HashMap;

public class JSONResult extends HashMap<String, Object> {
    public static JSONResult success(Object data,String... message) {
        JSONResult result = new JSONResult();
        result.put("code", 200);
        result.put("data", data);
        result.put("msg", message);
        return result;
    }

    public static JSONResult success(String... message) {
        JSONResult result = new JSONResult();
        result.put("code", 200);
        result.put("msg", message);
        return result;
    }

    public static JSONResult error(int errCode, String errMsg) {
        JSONResult result = new JSONResult();
        result.put("code", errCode);
        result.put("msg", errMsg);
        return result;
    }

    public static JSONResult error(String errMsg) {
        JSONResult result = new JSONResult();
        result.put("code", -1);
        result.put("msg", errMsg);
        return result;
    }
}
